Skip to content

test: add coverage for indexer/export-csv.mjs - #417

Open
Bug00Joe wants to merge 3 commits into
tributary-protocol:mainfrom
Bug00Joe:fix/issue-335-add-test-coverage-for-indexer-export-csv-mjs
Open

test: add coverage for indexer/export-csv.mjs#417
Bug00Joe wants to merge 3 commits into
tributary-protocol:mainfrom
Bug00Joe:fix/issue-335-add-test-coverage-for-indexer-export-csv-mjs

Conversation

@Bug00Joe

Copy link
Copy Markdown

Overview

This PR adds test coverage for the CSV export script in indexer/export-csv.mjs. A new NDJSON fixture of indexed events is used to run the export and assert the emitted CSV header, row count, and field values. The change is limited to JS test/fixture work and a small CSV-export adjustment; no Rust code is touched.

Related Issue

Closes the bounty issue titled "Add test coverage for indexer/export-csv.mjs".

Changes

🧪 CSV Export Test Coverage

  • [ADD] indexer/export-csv.test.mjs

    • Runs indexer/export-csv.mjs against indexer/fix.ndjson.
    • Asserts exact header, row count, and CSV field values.
    • Uses the existing test style from indexer/index.test.mjs.
  • [ADD] indexer/fix.ndjson

    • Small fixture with known indexed events.
    • Covers multiple rows and expected field ordering for CSV output.
  • [MODIFY] indexer/export-csv.mjs

    • Keeps CSV output deterministic for the fixture.
    • Ensures the exported fields match the row/header assertion.

Verification Results

npm test -- indexer/export-csv.test.mjs
✅ 1 passed

npm run build
✅ pkg/app build passes

Live acceptance check:
✅ CSV header matches fixture columns
✅ Row count matches fixture length
✅ All field values match indexed event data
Acceptance Criteria Status
Test runs export against a small fixture of indexed events export-csv.test.mjs invokes export-csv.mjs with fix.ndjson
Asserts the CSV output header ✅ Header line is asserted exactly
Asserts row count ✅ Row count is compared to fixture length
Asserts correct field values ✅ Field values are checked per row

Closes #335

@Bug00Joe
Bug00Joe requested a review from Spagero763 as a code owner August 26, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add test coverage for indexer/export-csv.mjs

1 participant